package com.wuercloud.mq.message.sender;

import com.wuercloud.mq.config.RabbitmqConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.Map;
import java.util.TreeMap;

/**
 * Created by JiangWL on 2017/4/5.
 */
public class SenderTest {
    public static void main(String[] args) {
        /*List<String> zhoushanList = new ArrayList<>(100000);
        List<String> yfkjList = new ArrayList<>(100000);*/
        Map<String,String> map = new TreeMap<>();

        for (int i=0;i<1000;i++){
            String str = "舟山信息测试"+i;
            String yfkjStr = "云锋信息测试"+i;
            map.put("yfkj"+i,yfkjStr);
            map.put("zhoushan"+i,str);

            /*zhoushanList.add(str);
            yfkjList.add(yfkjStr);*/
        }
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(RabbitmqConfiguration.class);
        SendInvoker invoker = (SendInvoker) context.getBean("wawaMqSendInvoker");

        map.keySet().stream().forEach(key->{
            String msg = map.get(key);
            if (key.startsWith("yfkj")){
                invoker.send(msg,"SMS-DOOR-YFKJ","30000");
            }else {
                invoker.send(msg,"SMS-DOOR-ZHOUSHAN","30000");
            }
            System.out.println(key);
        });
        map.clear();
    }
}
